<template>
  <div class="boss">
    <head-page id="backstyle" title="大项目"></head-page>
    <Banner id="5" class="bannerId"></Banner>
    <div class="war">
      <div class="area-center">
        <div class="center title-center">
          <div class="umit title_word">
            <div
              class="xiao m-t-07"
              v-for="(item, index) in list"
              :key="index"
              @click="Large(item)"
            >
              <div class="left">
                <div
                  class="yuan"
                  :class="[
                    'zhong',
                    item.projecttypeId == ID ? 'backactive' : '',
                  ]"
                ></div>
              </div>
              <div
                class="zhong"
                :class="['zhong', item.projecttypeId == ID ? 'active' : '']"
              >
                {{ item.projecttypeName }}
              </div>
            </div>

            <div class="shenghui">
              <div class="title_word title">请选择</div>
              <div class="bottom m-t-0">
                <div
                  class="text_top m-t-07"
                  @click="provincial(ID, city, citysub)"
                >
                  <div class="icon">
                    <img src="../../../assets/black_star.png" alt="" />
                  </div>
                  <div class="text">
                    {{ city }}
                  </div>
                </div>
                <!-- 全国各省和海外 -->
                <div
                  class="text_top m-t-07"
                  v-for="(item, index) in address"
                  :key="index"
                  @click="nationwide(item.text, ID, Headtitle)"
                >
                  <div class="icon">
                    <img src="../../../assets/black_star.png" alt="" />
                  </div>
                  <div class="text">
                    {{ item.text }}
                  </div>
                </div>
                <div
                  class="text_top m-t-07"
                  v-for="(item, index) in text"
                  :key="'text_top' + index"
                  @click="Major(item)"
                >
                  <div class="icon">
                    <img src="../../../assets/black_star.png" alt="" />
                  </div>
                  <div class="text">
                    {{ item.projecttypeName }}
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Banner from "@/components/Home/BannerView.vue";
import { projectType } from "@/api/index";
export default {
  data() {
    return {
      list: [],
      ID: this.$route.query.id,
      text: this.$route.query.i,
      Headtitle: "大项目",
      name: this.$route.query.name, //商会的类型
      city: sessionStorage.getItem("province") + "项目",
      citysub: sessionStorage.getItem("provincesub"),
      address: [{ text: "全国各省项目" }, { text: "海外项目" }],
      text: "",
    };
  },
  components: {
    Banner,
  },
  created() {
    //大项目列表
    projectType({
      projecttypeIdenti: "one",
    }).then((res) => {
      if (res.data.code == 200) {
        this.list = res.data.data;
      }
    }),
      // 单独的重大项目
      projectType({
        projecttypeIdenti: "all",
      }).then((res) => {
        if (res.data.code == 200) {
          this.text = res.data.data;
        }
      });
  },
  methods: {
    //定位的城市
    provincial(id, title, citysub) {
      this.$router.push({
        path: "/largedetails",
        query: { id, title, citysub },
      });
    },
    //全国各省和海外
    nationwide(title, id, Headtitle) {
      if (title == "全国各省项目") {
        this.$router.push({
          path: "/largenation",
          query: { title, id, Headtitle },
        });
      } else {
        this.$router.push({
          path: "/largedetails",
          query: {
            title,
            citysub: title.slice(0, 2),
            id,
          },
        });
      }
    },
    //重大项目
    Major(item) {
      this.$router.push({
        path: "largedetails",
        query: {
          id: item.projecttypeId,
          title: item.projecttypeName,
        },
      });
    },
    //列表跳转
    Large(item) {
      this.ID = item.projecttypeId;
      sessionStorage.setItem("LargeName", item.projecttypeName);
    },
  },
};
</script>

<style scoped>
.boss {
  width: 100%;
  height: 5rem;
}
/* 底部区域 */
.bottom {
  width: 100%;
  min-height: 2rem;
}
/* 版心区域 */
.bottom .center {
  width: 98%;
  min-height: 100%;
}
.umit {
  width: 100%;
  min-height: 0.4rem;
}
.xiao {
  width: 100%;
  display: flex;
}
/* 左边区域 */
.xiao .left {
  width: 5%;
  height: 0.3rem;
  margin-right: 0.07rem;
}
.xiao .left .yuan {
  width: 0.18rem;
  height: 0.18rem;
  border-radius: 50%;
  background-color: black;
  margin-top: 0.06rem;
}
/* 中间区域 */
.zhong {
  height: 100%;
  line-height: 0.32rem;
  margin-left: 0.03rem;
}
.title {
  width: 100%;
}
.shenghui {
  display: flex;
  flex-wrap: wrap;
  margin-top: 0.3rem;
}

.text_top {
  width: 100%;

  display: flex;
}
.text_top .icon {
  width: 9%;
}
.icon img {
  padding: 0.04rem 0 0 0.06rem;
  height: 0.2rem;
}

.text_top .text {
  width: 90%;
  line-height: 0.3rem;
}
</style>